import Router from '@koa/router';
import * as permissionController from '../controllers/permission.controller';
import { authMiddleware, adminMiddleware } from '../middleware/auth';

const router = new Router({
  prefix: '/api/permissions',
});

// 所有路由都需要认证和管理员权限
router.use(authMiddleware);
router.use(adminMiddleware);

// 创建权限
router.post('/create', permissionController.createPermission);

// 更新权限
router.post('/update', permissionController.updatePermission);

// 删除权限
router.post('/delete', permissionController.deletePermission);

// 查询权限列表
router.post('/list', permissionController.getPermissionList);

// 查询权限详情
router.post('/detail', permissionController.getPermissionDetail);

export default router;

